package com.example.t1.Fragment;

import com.example.t1.R;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class BaseFragment extends Fragment {
    private boolean DEBUG = true;

    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	log("onCreate");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
	    Bundle savedInstanceState) {
	log("onCreateView");
	return inflater.inflate(R.layout.fragment1, null);
    }

    /**
     * 
     * 描述： called once the fragment is associated with its activity.
     * 
     * @see android.support.v4.app.Fragment#onAttach(android.app.Activity)
     * @author: 智讯 zhixun123@gmail.com
     * @date：2013-12-23 下午4:04:52
     */
    @Override
    public void onAttach(Activity activity) {
	super.onAttach(activity);
	log("onAttach");
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
	super.onActivityCreated(savedInstanceState);
	log("onActivityCreated");
    }

    @Override
    public void onViewStateRestored(Bundle savedInstanceState) {
	super.onViewStateRestored(savedInstanceState);
	log("onViewStateRestored");
    }

    @Override
    public void onStart() {
	super.onStart();
	log("onStart");
    }

    @Override
    public void onResume() {
	super.onResume();
	log("onResume");
    }

    @Override
    public void onPause() {
	super.onPause();
	log("onPause");
    }

    @Override
    public void onStop() {
	super.onStop();
	log("onStop");
    }

    @Override
    public void onDestroy() {
	super.onDestroy();
	log("onDestroy");
    }

    @Override
    public void onDestroyView() {
	super.onDestroyView();
	log("onDestroyView");
    }

    @Override
    public void onDetach() {
	super.onDetach();
	log("onDetach");
    }

    private void log(String str) {
	if (DEBUG) {
	    Log.d(getClass().getName(), str);
	}
    }
}
